package com.dingding.common.core.config;

import org.apache.log4j.Logger;

/**
 * 
 * @ClassName: ImageUploadConfig 
 * @Description:图片上传相关地址配置
 * @author CHEHAUNBO 
 * @date 2016年5月25日 下午6:00:57
 * 
 */
public class ImageUploadConfig extends AbstractConfig {

	private Logger log = Logger.getLogger(ImageUploadConfig.class);

	// 上传环境
	private boolean env_imageupload = true;

	// 图片上传token
	private static String IMAGE_UPLOAD_ACCESSID = Constants.IMAGE_UPLOAD_ACCESSID;
	// 图片上传秘钥
	private static String IMAGE_UPLOAD_ACCESS_SECRET = Constants.IMAGE_UPLOAD_ACCESS_SECRET;

	// 图片上传地址，默认为正式地址
	private static String IMAGE_UPLOAD_PATH = Constants.IMAGE_PRODUCE_UPLOAD_PATH;

	// 图片访问地址，默认为正式地址
	private static String IMAGE_ACCESS_PATH = Constants.IMAGE_PRODUCE_ACCESS_PATH;

	// 图片上传空间，默认为正式空间
	private static String STORE_BUCKETNAME = Constants.IMAGE_PRODUCE_UPLOAD_BUCKETNAME;

	/**
	 * 初始化图片上传配置
	 * @Title: intitalConfigValue 
	 * @author CHEHAUNBO
	 * 
	 */
	@Override
	public void intitalConfigValue() {

		boolean flag = prop.getBoolean("env_imageupload");

		if (!flag) { // 测试环境
			env_imageupload = flag;
			IMAGE_UPLOAD_PATH = Constants.IMAGE_PRODUCE_UPLOAD_PATH;
			IMAGE_ACCESS_PATH = Constants.IMAGE_PRODUCE_ACCESS_PATH;
			STORE_BUCKETNAME = Constants.IMAGE_PRODUCE_UPLOAD_BUCKETNAME;
		}

		log.info("正在初始化图片上传相关配置！初始化后的值：" + toString());

	}

	public static String getIMAGE_UPLOAD_PATH() {
		return IMAGE_UPLOAD_PATH;
	}

	public static String getIMAGE_ACCESS_PATH() {
		return IMAGE_ACCESS_PATH;
	}

	public static String getSTORE_BUCKETNAME() {
		return STORE_BUCKETNAME;
	}
	
	
	public static String getIMAGE_UPLOAD_ACCESSID() {
		return IMAGE_UPLOAD_ACCESSID;
	}

	public static String getIMAGE_UPLOAD_ACCESS_SECRET() {
		return IMAGE_UPLOAD_ACCESS_SECRET;
	}

	public String toString() {

		return "上传环境：" + env_imageupload + "[IMAGE_UPLOAD_PATH]:" + IMAGE_UPLOAD_PATH + "[IMAGE_ACCESS_PATH]:"
				+ IMAGE_ACCESS_PATH + "[STORE_BUCKETNAME]:" + STORE_BUCKETNAME;

	}

}
